﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="ContactEdit.aspx.cs" Inherits="_6i.ContactEdit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="form1" runat="server">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:asp-6iConnectionString3 %>" 
    ProviderName="<%$ ConnectionStrings:asp-6iConnectionString3.ProviderName %>" 
        
        SelectCommand="SELECT [ID], [Title], [FirstName], [LastName], [MiddleName], [JobTitle], [Company], [Website], [OfficePhone], [HomePhone], [Mobile], [Fax], [Email], [Address], [City], [Province], [PostalCode] FROM [Contacts]" 
        ConflictDetection="CompareAllValues" 
        DeleteCommand="DELETE FROM [Contacts] WHERE [ID] = ? AND (([Title] = ?) OR ([Title] IS NULL AND ? IS NULL)) AND (([FirstName] = ?) OR ([FirstName] IS NULL AND ? IS NULL)) AND (([LastName] = ?) OR ([LastName] IS NULL AND ? IS NULL)) AND (([MiddleName] = ?) OR ([MiddleName] IS NULL AND ? IS NULL)) AND (([JobTitle] = ?) OR ([JobTitle] IS NULL AND ? IS NULL)) AND (([Company] = ?) OR ([Company] IS NULL AND ? IS NULL)) AND (([Website] = ?) OR ([Website] IS NULL AND ? IS NULL)) AND (([OfficePhone] = ?) OR ([OfficePhone] IS NULL AND ? IS NULL)) AND (([HomePhone] = ?) OR ([HomePhone] IS NULL AND ? IS NULL)) AND (([Mobile] = ?) OR ([Mobile] IS NULL AND ? IS NULL)) AND (([Fax] = ?) OR ([Fax] IS NULL AND ? IS NULL)) AND (([Email] = ?) OR ([Email] IS NULL AND ? IS NULL)) AND (([Address] = ?) OR ([Address] IS NULL AND ? IS NULL)) AND (([City] = ?) OR ([City] IS NULL AND ? IS NULL)) AND (([Province] = ?) OR ([Province] IS NULL AND ? IS NULL)) AND (([PostalCode] = ?) OR ([PostalCode] IS NULL AND ? IS NULL))" 
        InsertCommand="INSERT INTO [Contacts] ([ID], [Title], [FirstName], [LastName], [MiddleName], [JobTitle], [Company], [Website], [OfficePhone], [HomePhone], [Mobile], [Fax], [Email], [Address], [City], [Province], [PostalCode]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" 
        OldValuesParameterFormatString="original_{0}" 
        UpdateCommand="UPDATE [Contacts] SET [Title] = ?, [FirstName] = ?, [LastName] = ?, [MiddleName] = ?, [JobTitle] = ?, [Company] = ?, [Website] = ?, [OfficePhone] = ?, [HomePhone] = ?, [Mobile] = ?, [Fax] = ?, [Email] = ?, [Address] = ?, [City] = ?, [Province] = ?, [PostalCode] = ? WHERE [ID] = ? AND (([Title] = ?) OR ([Title] IS NULL AND ? IS NULL)) AND (([FirstName] = ?) OR ([FirstName] IS NULL AND ? IS NULL)) AND (([LastName] = ?) OR ([LastName] IS NULL AND ? IS NULL)) AND (([MiddleName] = ?) OR ([MiddleName] IS NULL AND ? IS NULL)) AND (([JobTitle] = ?) OR ([JobTitle] IS NULL AND ? IS NULL)) AND (([Company] = ?) OR ([Company] IS NULL AND ? IS NULL)) AND (([Website] = ?) OR ([Website] IS NULL AND ? IS NULL)) AND (([OfficePhone] = ?) OR ([OfficePhone] IS NULL AND ? IS NULL)) AND (([HomePhone] = ?) OR ([HomePhone] IS NULL AND ? IS NULL)) AND (([Mobile] = ?) OR ([Mobile] IS NULL AND ? IS NULL)) AND (([Fax] = ?) OR ([Fax] IS NULL AND ? IS NULL)) AND (([Email] = ?) OR ([Email] IS NULL AND ? IS NULL)) AND (([Address] = ?) OR ([Address] IS NULL AND ? IS NULL)) AND (([City] = ?) OR ([City] IS NULL AND ? IS NULL)) AND (([Province] = ?) OR ([Province] IS NULL AND ? IS NULL)) AND (([PostalCode] = ?) OR ([PostalCode] IS NULL AND ? IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_ID" Type="Int32" />
            <asp:Parameter Name="original_Title" Type="String" />
            <asp:Parameter Name="original_Title" Type="String" />
            <asp:Parameter Name="original_FirstName" Type="String" />
            <asp:Parameter Name="original_FirstName" Type="String" />
            <asp:Parameter Name="original_LastName" Type="String" />
            <asp:Parameter Name="original_LastName" Type="String" />
            <asp:Parameter Name="original_MiddleName" Type="String" />
            <asp:Parameter Name="original_MiddleName" Type="String" />
            <asp:Parameter Name="original_JobTitle" Type="String" />
            <asp:Parameter Name="original_JobTitle" Type="String" />
            <asp:Parameter Name="original_Company" Type="String" />
            <asp:Parameter Name="original_Company" Type="String" />
            <asp:Parameter Name="original_Website" Type="String" />
            <asp:Parameter Name="original_Website" Type="String" />
            <asp:Parameter Name="original_OfficePhone" Type="String" />
            <asp:Parameter Name="original_OfficePhone" Type="String" />
            <asp:Parameter Name="original_HomePhone" Type="String" />
            <asp:Parameter Name="original_HomePhone" Type="String" />
            <asp:Parameter Name="original_Mobile" Type="String" />
            <asp:Parameter Name="original_Mobile" Type="String" />
            <asp:Parameter Name="original_Fax" Type="String" />
            <asp:Parameter Name="original_Fax" Type="String" />
            <asp:Parameter Name="original_Email" Type="String" />
            <asp:Parameter Name="original_Email" Type="String" />
            <asp:Parameter Name="original_Address" Type="String" />
            <asp:Parameter Name="original_Address" Type="String" />
            <asp:Parameter Name="original_City" Type="String" />
            <asp:Parameter Name="original_City" Type="String" />
            <asp:Parameter Name="original_Province" Type="String" />
            <asp:Parameter Name="original_Province" Type="String" />
            <asp:Parameter Name="original_PostalCode" Type="String" />
            <asp:Parameter Name="original_PostalCode" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="ID" Type="Int32" />
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="MiddleName" Type="String" />
            <asp:Parameter Name="JobTitle" Type="String" />
            <asp:Parameter Name="Company" Type="String" />
            <asp:Parameter Name="Website" Type="String" />
            <asp:Parameter Name="OfficePhone" Type="String" />
            <asp:Parameter Name="HomePhone" Type="String" />
            <asp:Parameter Name="Mobile" Type="String" />
            <asp:Parameter Name="Fax" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="Province" Type="String" />
            <asp:Parameter Name="PostalCode" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="MiddleName" Type="String" />
            <asp:Parameter Name="JobTitle" Type="String" />
            <asp:Parameter Name="Company" Type="String" />
            <asp:Parameter Name="Website" Type="String" />
            <asp:Parameter Name="OfficePhone" Type="String" />
            <asp:Parameter Name="HomePhone" Type="String" />
            <asp:Parameter Name="Mobile" Type="String" />
            <asp:Parameter Name="Fax" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="Province" Type="String" />
            <asp:Parameter Name="PostalCode" Type="String" />
            <asp:Parameter Name="original_ID" Type="Int32" />
            <asp:Parameter Name="original_Title" Type="String" />
            <asp:Parameter Name="original_Title" Type="String" />
            <asp:Parameter Name="original_FirstName" Type="String" />
            <asp:Parameter Name="original_FirstName" Type="String" />
            <asp:Parameter Name="original_LastName" Type="String" />
            <asp:Parameter Name="original_LastName" Type="String" />
            <asp:Parameter Name="original_MiddleName" Type="String" />
            <asp:Parameter Name="original_MiddleName" Type="String" />
            <asp:Parameter Name="original_JobTitle" Type="String" />
            <asp:Parameter Name="original_JobTitle" Type="String" />
            <asp:Parameter Name="original_Company" Type="String" />
            <asp:Parameter Name="original_Company" Type="String" />
            <asp:Parameter Name="original_Website" Type="String" />
            <asp:Parameter Name="original_Website" Type="String" />
            <asp:Parameter Name="original_OfficePhone" Type="String" />
            <asp:Parameter Name="original_OfficePhone" Type="String" />
            <asp:Parameter Name="original_HomePhone" Type="String" />
            <asp:Parameter Name="original_HomePhone" Type="String" />
            <asp:Parameter Name="original_Mobile" Type="String" />
            <asp:Parameter Name="original_Mobile" Type="String" />
            <asp:Parameter Name="original_Fax" Type="String" />
            <asp:Parameter Name="original_Fax" Type="String" />
            <asp:Parameter Name="original_Email" Type="String" />
            <asp:Parameter Name="original_Email" Type="String" />
            <asp:Parameter Name="original_Address" Type="String" />
            <asp:Parameter Name="original_Address" Type="String" />
            <asp:Parameter Name="original_City" Type="String" />
            <asp:Parameter Name="original_City" Type="String" />
            <asp:Parameter Name="original_Province" Type="String" />
            <asp:Parameter Name="original_Province" Type="String" />
            <asp:Parameter Name="original_PostalCode" Type="String" />
            <asp:Parameter Name="original_PostalCode" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <br />
    
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        CellPadding="4" DataKeyNames="ID" DataSourceID="SqlDataSource1" 
        DefaultMode="Edit" EnableModelValidation="True" ForeColor="#333333" 
        GridLines="None" Height="50px" Width="125px">
        <Fields>
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
            <asp:TemplateField HeaderText="FirstName" SortExpression="FirstName">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="valFN" runat="server" 
        ErrorMessage="First Name Required" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="LastName" SortExpression="LastName">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="ValLN" runat="server" 
        ErrorMessage="Last Name Required" ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="MiddleName" HeaderText="MiddleName" 
                SortExpression="MiddleName" />
            <asp:BoundField DataField="JobTitle" HeaderText="JobTitle" 
                SortExpression="JobTitle" />
            <asp:BoundField DataField="Company" HeaderText="Company" 
                SortExpression="Company" />
            <asp:BoundField DataField="Website" HeaderText="Website" 
                SortExpression="Website" />
            <asp:BoundField DataField="OfficePhone" HeaderText="OfficePhone" 
                SortExpression="OfficePhone" />
            <asp:TemplateField HeaderText="HomePhone" SortExpression="HomePhone">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("HomePhone") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="ValHP" runat="server" 
        ErrorMessage="Home Phone Required" ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("HomePhone") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("HomePhone") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Mobile" HeaderText="Mobile" 
                SortExpression="Mobile" />
            <asp:BoundField DataField="Fax" HeaderText="Fax" SortExpression="Fax" />
            <asp:TemplateField HeaderText="Email" SortExpression="Email">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Email") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="ValEmail" runat="server" 
        ErrorMessage="Email Address Required " ControlToValidate="TextBox4"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Email") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("Email") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Address" SortExpression="Address">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="ValAddress" runat="server" 
        ErrorMessage="Address Required" ControlToValidate="TextBox5"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("Address") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
            <asp:BoundField DataField="Province" HeaderText="Province" 
                SortExpression="Province" />
            <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" 
                SortExpression="PostalCode" />
            <asp:CommandField ShowEditButton="True" />
        </Fields>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
        <RowStyle BackColor="#EFF3FB" />
        <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:DetailsView>
    </form>
</asp:Content>
